<?php
/**
 * Created by PhpStorm.
 * User: function
 * Date: 2018-04-12
 * Time: 20:47
 */

namespace app\common\logic;
use app\common\logic\Logic;
use app\common\model\Spread;

class SpreadLogic extends Logic
{
    protected $modelClass = 'app\common\model\Spread';
    protected $column = 'id,pid,status,areaid,user_id,word';
    
    public function add($params){
        
        $filter = ['user_id'=>$params['user_id'],'word'=>$params['word'],'status'=>array('GT',-1)];
        $isHas = Spread::where($filter)->field('id')->select();
        if($isHas){
            return callerror('该商户已经对该关键词竞价');
        }
        $rt = parent::add($params);
        return callsuccess($rt);
    }
    
    
}